import DialogBase from "../../../common/cmpt/base/DialogBase";
import JellyTweenCases from "./JellyTweenCases";

const { ccclass, property } = cc._decorator;

@ccclass
export default class DlgJellyTween extends DialogBase {
    public static pUrl: string = 'LyDialog/DlgJellyTween'
    @property(JellyTweenCases)
    jellyCtl: JellyTweenCases = null
    // LIFE-CYCLE CALLBACKS:

    // onLoad () {}

    start() {

    }

    // update (dt) {}
    /**大小缩放效果 */
    scaleTweenServer() {
        this.init1()
        this.jellyCtl.scaleTweenServer()
    }
    /**左右弹簧运动 */
    backForthServer() {
       this.init1()
        this.jellyCtl.sitTweenServer(cc.v2(100, 0))
    }
    /**果冻掉落 */
    jellyFallServer() {
        this.init2()
        this.jellyCtl.scaleTweenServer()
        this.jellyCtl.jellyFall(cc.v2(0, 200))
    }

    init1(){
        this.jellyCtl.node.setPosition(0, 0)
        this.jellyCtl.node.setScale(1)
        this.jellyCtl.frequency = 4
        this.jellyCtl.decay = 2
        this.jellyCtl.totalTime = 1
        this.jellyCtl.pressScale = 0.2
        this.jellyCtl.stopAllTween()
    }

    init2(){
        this.jellyCtl.node.setPosition(0, 200)
        this.jellyCtl.node.setScale(1)
        this.jellyCtl.frequency = 2
        this.jellyCtl.decay = 2.7
        this.jellyCtl.totalTime = 1.3
        this.jellyCtl.pressScale = 0.3
        this.jellyCtl.stopAllTween()
    }


}
